package chapter02;

import java.util.Scanner;

public class Xiaoming1 {
    public static void main(String[] args) {
        int shuben = 12;
        int qianbi=1;
        int xiangpi =2;
        int kele = 3;
        int lingshi = 5;

        System.out.println("书本的价格为"+shuben+"元，您总共有20元");
        System.out.println("1.铅笔的价格为"+qianbi+"元");
        System.out.println("2.橡皮的价格为"+xiangpi+"元");
        System.out.println("3.可乐的价格为"+kele+"元");
        System.out.println("4.零食的价格为"+lingshi+"元");
        Scanner scl = new  Scanner(System.in);
        System.out.println("请输入其他需要购买商品的序列号：");
        int id =scl.nextInt();
        switch (id){
            case 1:
                int qianbimoney=20-shuben;
                int qianbishengyu=qianbimoney/qianbi;
                int qianbiduoyu=qianbimoney%qianbi;
                System.out.println("购买完书本后还可以购买铅笔"+qianbishengyu+"个，还剩"+qianbiduoyu+"元");
                break;
            case 2:
                int xiangpimoney=20-shuben;
                int xiangpishengyu=xiangpimoney/xiangpi;
                int xiangpiduoyu=xiangpimoney%xiangpi;
                System.out.println("购买完书本后还可以购买橡皮"+xiangpishengyu+"个，还剩"+xiangpiduoyu+"元");
                break;
            case 3:
                int kelemoney=20-shuben;
                int keleshengyu=kelemoney/kele;
                int keleduoyu=kelemoney%kele;
                System.out.println("购买完书本后还可以购买可乐"+keleshengyu+"个，还剩"+keleduoyu+"元");
                break;
            case 4:
                int lingshimoney=20-shuben;
                int lingshishengyu=lingshimoney/lingshi;
                int lingshiduoyu=lingshimoney%lingshi;
                System.out.println("购买完书本后还可以购买零食"+lingshishengyu+"个，还剩"+lingshiduoyu+"元");
                break;
            default:
                System.out.println("输入的数字不正确...");
        }

    }
}

